package com.smile.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.smile.api.OssApi;
import com.smile.commons.file.FileUtils;
import com.smile.commons.gps.RouteFileUtils;
import com.smile.commons.gps.domain.*;
import com.smile.commons.gps.domain.kml.*;
import com.smile.commons.gps.kml.*;
import com.smile.commons.page.R;
import com.smile.mapper.FlightTaskMapper;
import com.smile.model.domain.FeisuanFlightTask;
import com.smile.model.dto.request.AddFlightTaskRequestDTO;
import com.smile.model.dto.request.GenerateAirlineFileRequestDTO;
import com.smile.model.dto.request.GenerateWaypointActionRequestDTO;
import com.smile.model.dto.request.GenerateWaypointRequestDTO;
import com.smile.model.response.PutFileResponse;
import com.smile.model.response.response.GenerateAirlineFileResponseDTO;
import com.smile.service.FlightTaskService;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static com.smile.commons.gps.RouteFileUtils.buildKml;
import static com.smile.commons.gps.RouteFileUtils.buildWpml;

@Service
public class FlightTaskServiceImpl implements FlightTaskService {

    private static final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";

    private static final String LOCAL_KMZ_FILE_PATH = "file" + File.separator + "kmz" + File.separator;



    @Autowired
    private FlightTaskMapper flightTaskMapper;

    @Override
    public Boolean addFlightTask(AddFlightTaskRequestDTO generateAirlineFileRequestDTO) throws IOException {
        FeisuanFlightTask feisuanFlightTask = new FeisuanFlightTask();
        BeanUtil.copyProperties(generateAirlineFileRequestDTO, feisuanFlightTask);
        flightTaskMapper.insert(feisuanFlightTask);
        return true;
    }
}
